package io;

import java.io.*;

/**
 * Buffered  是高级流，作用是加快读写效率
 * 1） BufferedInputStream: 缓冲输入流
 * 1） BufferedOutputStream: 缓冲输出流
 */
public class CopyDemo03 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis=new FileInputStream("view.jpg");
        FileOutputStream fos=new FileOutputStream("view_coppy.jpg");
        BufferedInputStream bis=new BufferedInputStream(fis);
        BufferedOutputStream bos=new BufferedOutputStream(fos);
        long start=System.currentTimeMillis();
        int temp;
        while((temp=bis.read())!=-1){
            bos.write(temp);
        }
        long end=System.currentTimeMillis();
        System.out.println("复制完毕，耗时："+(end-start)+"ms");
        bis.close();
        bos.close();
    }
}
